home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung 2
/
Power-Programmierung CD 2 (Tewi)(1994).iso
/
c
/
library
/
dos
/
diverses
/
snip
/
bitcount.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1990-06-25
|
326 b
|
16 lines
/****** BIT COUNTER *************/
bit_count(x)
{
int n=0;
if (x) do
n++;
while(x=x&(x-1));
return(n);
}/*******************************/
/*
** The loop will execute once for each bit of x set, this is in average
** twice as fast as the shift/test method.
*/